﻿using System;
using System.IO;
using System.Threading.Tasks;
using Windows.Storage;

namespace LibQuestionIs.Extensions
{
    public static class FileExtensions
    {
        public async static Task<StorageFile> TryGetFileAsync(this IStorageFolder folder, string fileName)
        {
            try
            {
                var file = await folder.GetFileAsync(fileName);
                return file;
            }
            catch (FileNotFoundException)
            {
                return null;
            }
        }
    }
}
